package main

import (
	"fmt"
	"time"
)

func main() {
	intChan := make(chan int, 1)
	// 3秒后关闭通道
	time.AfterFunc(time.Second * 3, func() {
		close(intChan)
	})
	select {
	case _, ok := <- intChan:
		if !ok {
			fmt.Println("通道已经关闭")
			break
		}
		fmt.Println("通道里有值传入")
	}
}